#ifndef MEDIAMANAGER_H
#define MEDIAMANAGER_H

#include "bga/system/ScatteredHierarchy.h"
#include "bga/system/Singleton.h"

#include "bga/graphics/Drawable.h"
#include "bga/graphics/Texture2D.h"
#include "bga/graphics/TextureCubeMap.h"
#include "bga/graphics/Shader.h"

#include "bga/application/MediaHolder.h"

typedef TYPELIST_4(bga::Drawable, bga::Texture2D, bga::TextureCubeMap, bga::Shader) mediaList;

/*!
 * \namespace bga
 *
 */
namespace bga
{

class BOARD_HELL_ENGINE MediaManager : public Singleton<MediaManager>,
                                public ScatteredHierarchy< mediaList, MediaHolder >
{
    friend class Singleton<MediaManager>;

    private:
        MediaManager();
        MediaManager(const MediaManager& mediaManager);
        MediaManager& operator=(const MediaManager& mediaManager);

        template< typename T >
        Loader<T>* findLoader(const std::string& extension);

    public:
        virtual ~MediaManager();

        template< typename T>
        void registerLoader(Loader<T>* loader, const std::string& extension);

        template< typename T >
        T* loadFromFile(const std::string& filename);


};

}

#include "bga/application/MediaManager.inl"

#endif // MEDIAMANAGER_H

